// -*- coding: utf-8 -*- 
/**
 * Project: AlgorithmsLearn
 * Creator: yanking
 * Create time: 2022-02-28 14:09
 * IDE: IntelliJ IDEA
 * Introduction:
 */
package com.LeetCodeT.Greedy;

import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class RemoveDuplicateLetters {
    // 去掉字符串中的重复数字
    public String removeDuplicateLetters(String s) {
        int n = s.length();
        Character[] c = new Character[n];
        for (int i = 0; i < s.length(); i++) {
            c[i] = s.charAt(i);
        }
        StringBuilder builder = new StringBuilder();

        Arrays.stream(c).distinct().sorted().forEach(builder::append);
        return builder.toString();
    }


}
